package lab02.Test03;

import java.util.Scanner;

/**
 * Created by Administrator on 2017/10/12.
 */
public class Student {
    public static void main(String[] args) {
        String name;
        System.out.println("请输入学生姓名：");
        Scanner sc = new Scanner(System.in);
        name = sc.nextLine();
        String sex;
        System.out.println("请输入学生性别：");
        Scanner a = new Scanner(System.in);
        sex = a.nextLine();
        int grade_Computer;
        System.out.println("请输入学生计算机成绩：");
        Scanner b = new Scanner(System.in);
        grade_Computer = b.nextInt();
        int grade_Math;
        System.out.println("请输入学生数学成绩：");
        Scanner c = new Scanner(System.in);
        grade_Math = c.nextInt();
        int grade_English;
        System.out.println("请输入学生英语成绩：");
        Scanner d = new Scanner(System.in);
        grade_English = d.nextInt();
        System.out.println(name);
        System.out.println(sex);
        System.out.print("总分为：");
        Sum(grade_Computer, grade_English, grade_Math);
        System.out.print("平均分为：");
        Average(grade_Computer, grade_English, grade_Math);
        Max(grade_Computer, grade_English, grade_Math);
        Min(grade_Computer, grade_English, grade_Math);
    }

    public static void Sum(int a, int b, int c) {
        int sum;
        sum = a + b + c;
        System.out.println(sum);
    }

    public static void Average(int a, int b, int c) {
        int aver;
        aver = (a + b + c) / 3;
        System.out.println(aver);
    }

    public static void Max(int a, int b, int c) {
        int temp, max;
        temp = a > b ? a : b;
        max = temp > c ? temp : c;
        if (max == a) {
            System.out.println("最高是计算机成绩为" + max);
        } else if (max == b)
            System.out.println("最高是英语成绩为" + max);
        else
            System.out.println("最高是数学成绩为" + max);
    }

    public static void Min(int a, int b, int c) {
        int temp, min;
        temp = a > b ? b : a;
        min = temp > c ? c : temp;
        System.out.print(min);
        if (min == a) {
            System.out.println("最低是计算机成绩为" + min);
        } else if (min == b)
            System.out.println("最低是英语成绩为" + min);
        else
            System.out.println("最低是数学成绩为" + min);
    }
}
